<script>
    //    var group = Array();

    function getParent(parent_id, key, p) {
        $.post('<?php echo url('columns/dumpParent') ?>', {parent_id:parent_id}, function(data) {
            var json = toJSON(data);
            if(!json.length) return;
            var str = '<ul><li><b>'+key+'</b></li><li><b>:</b></li><li id="s_menu_'+p+'" class="item"><a href="?controller=articles&col_id=' +p+'">全部</a></li>';
            for(var i=0;i<json.length;i++) {
                str += '<li><b>:</b></li>';
                str += '<li id="" class="item s_menu_'+json[i].col_id+'"><a href="<?php echo url('') ?>&col_id=' +json[i].col_id+ '">' +json[i].name+ '</a></li>';
            }
            str += '</ul>';

            $('#s_menu').append(str);
        })
    }

<?php if($parents): ?>
    $('.item').removeClass('on');
<?php endif ?>
    $(function(){
        $.ajaxSetup({
            async: false
        });
        var group = Array('部门', '科目', '文件');
<?php $s = 0; ?>
<?php foreach($parents as $key=>$parent): ?>
        getParent(<?php echo $parent ?>, group[<?php echo $s ?>], <?php echo intval($parents[$key]) ?>);
        $('.s_menu_<?php echo $parent ?>').addClass('on').removeClass('off');
<?php $s++; ?>
<?php endforeach ?>
    })
    $.ajaxSetup({
        async: true
    });
</script>
<div class="subnav w934">
    <div class="tit"></div>
    <div class="cont" id="s_menu"></div>
</div>